class Hajime extends egret.Sprite{
	private loadingui:LoadingUI;
	public constructor() {
		super();
		RES.addEventListener(RES.ResourceEvent.GROUP_COMPLETE,this.onGroupComplete,this);
		RES.addEventListener(RES.ResourceEvent.GROUP_PROGRESS,this.onResourceProgress,this);

		RES.loadConfig("resource/default.res.json","resource/");
		//加载初始化资源
		RES.loadGroup("loading");


	}
	private onGroupComplete(event:RES.ResourceEvent){
		if(event.groupName=="loading"){
			//初始化资源加载完成
			this.loadingui=new LoadingUI();
			this.addChild(this.loadingui);
			//加载正式资源
			RES.loadGroup("preload");
		}
	}
	private onResourceProgress(event:RES.ResourceEvent){
		if(event.groupName=="preload"){
			//显示进度条变化
			var arr=[event.itemsLoaded,event.itemsTotal];
			this.loadingui.SetProgress(event.itemsLoaded,event.itemsTotal);
			//进度条100%时,加载正片
			if(event.itemsLoaded==event.itemsTotal){
				this.dispatchEvent(new GoEvent(GoEvent.ResourceLoaded));
			}
		}
	}
	
}